<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>专辑添加</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
	<script type="text/javascript">
	$(document).ready(function(){
		$("#name").keyup(function(){
			var artistname=$("#name").attr("value");
			$("#li").html("");
			var html = "";
			$.ajax({
				url:'<%=basePath%>/tracks/loadArtist',
				data:{'artistname':artistname},
				type:'POST',
				dataType:'json',
				success:function(data){
					data.forEach(function(d,i,a){
						html +="<option value="+d.artistid+">"+d.artistname+"</option>";
					});
					$("#dataList").html(html);
				},
				error:function(data){
					alert("error");
				}
			});
		});
		$("li").click(function(){
			//$("#myid").attr("value",$("#item").attr("KV"));
			alert("hello");
		});
		$("#btn").click(function(){
			$("#label").html($("#myid").attr("value"));
		});
	});
	</script>
  </head>
  
  <body>
    <input type="text" list="dataList"/>
    <datalist id="dataList">
    	
    </datalist>
    <input id="btn" type="button" value="查询"/>
    <p id="label"></p>
  </body>
</html>
